<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>注册 - HUAPLE</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css" rel="stylesheet">
    <script>
        tailwind.config = {
            theme: {
                extend: {
                    colors: {
                        accent: '#3498db',
                        'accent-dark': '#2980b9',
                        bg: '#f7f9fc',
                        text: '#111827',
                        muted: '#6b7280',
                        card: '#ffffff',
                    },
                    boxShadow: {
                        'sm': '0 2px 8px rgba(12,20,40,0.04)',
                        'md': '0 6px 20px rgba(10,14,30,0.04)',
                        'lg': '0 8px 30px rgba(12,20,40,0.06)',
                    }
                },
            }
        }
    </script>
    <style type="text/tailwindcss">
        @layer utilities {
            .content-auto {
                content-visibility: auto;
            }
            .text-shadow {
                text-shadow: 0 2px 4px rgba(0,0,0,0.1);
            }
            .input-focus {
                @apply focus:border-accent focus:ring-2 focus:ring-accent/20 focus:outline-none;
            }
        }
    </style>
</head>
<body class="bg-bg text-text font-sans antialiased min-h-screen flex flex-col">
    <!-- 顶部导航栏（Logo跳转回首页） -->
    <nav class="top-nav bg-white border-b border-gray-200 shadow-sm fixed top-0 left-0 right-0 z-50">
        <div class="container mx-auto px-4 flex items-center justify-between h-16">
            <a href="index.html" class="huawei-logo flex items-center font-bold text-xl text-text no-underline">
                <img src="logo.png" alt="HUAPLE 品牌Logo" class="h-8 w-auto mr-2">
                <span class="text-accent hidden md:inline">HUA</span>PLE
            </a>
            
            <div class="huawei-main-nav flex items-center">
                <ul class="huawei-nav-links hidden md:flex list-none mr-8">
                    <li class="mx-3"><a href="service.html" class="text-text hover:text-accent transition-colors duration-300 py-2">服务支持</a></li>
                    <li class="mx-3"><a href="about.html" class="text-text hover:text-accent transition-colors duration-300 py-2">关于华凤</a></li>
                </ul>
                
                <div class="huawei-nav-utils flex items-center">
                    <a href="group.html" class="text-muted hover:text-accent transition-colors duration-300 text-sm ml-4">集团网站</a>
                    <a href="login.html" class="text-text hover:text-accent transition-colors duration-300 text-sm ml-4">登录</a>
                    <a href="register.html" class="text-accent border-b-2 border-accent text-sm ml-4">注册</a>
                    <button class="md:hidden ml-4 text-text focus:outline-none">
                        <i class="fa fa-bars text-xl"></i>
                    </button>
                </div>
            </div>
        </div>
    </nav>

    <!-- 主体内容 -->
    <main class="flex-grow pt-24 pb-16 flex items-center justify-center">
        <div class="container mx-auto px-4">
            <div class="max-w-md w-full mx-auto bg-card rounded-xl shadow-lg overflow-hidden">
                <!-- 注册标题区 -->
                <div class="p-8 border-b border-gray-100">
                    <h1 class="text-2xl font-bold text-center mb-2">账号注册</h1>
                    <p class="text-muted text-center text-sm">注册即同意《用户服务条款》和《隐私政策》</p>
                </div>
                
                <!-- 注册表单 -->
                <div class="p-8">
                    <form id="registerForm">
                        <!-- 手机号输入 -->
                        <div class="mb-6">
                            <label for="phone" class="block text-sm font-medium text-muted mb-2">手机号</label>
                            <div class="relative">
                                <span class="absolute inset-y-0 left-0 flex items-center pl-3 text-muted">
                                    <i class="fa fa-mobile"></i>
                                </span>
                                <input type="tel" id="phone" class="w-full pl-10 pr-4 py-3 border border-gray-300 rounded-lg input-focus transition-all duration-300" placeholder="请输入手机号" required>
                            </div>
                        </div>
                        
                        <!-- 验证码输入 -->
                        <div class="mb-6">
                            <label for="code" class="block text-sm font-medium text-muted mb-2">验证码</label>
                            <div class="relative">
                                <span class="absolute inset-y-0 left-0 flex items-center pl-3 text-muted">
                                    <i class="fa fa-shield"></i>
                                </span>
                                <input type="text" id="code" class="w-full pl-10 pr-36 py-3 border border-gray-300 rounded-lg input-focus transition-all duration-300" placeholder="请输入验证码" required>
                                <button type="button" id="getCodeBtn" class="absolute inset-y-0 right-0 flex items-center justify-center w-32 text-accent border border-accent rounded-r-lg hover:bg-accent hover:text-white transition-all duration-300">
                                    获取验证码
                                </button>
                            </div>
                        </div>
                        
                        <!-- 密码输入 -->
                        <div class="mb-6">
                            <label for="regPassword" class="block text-sm font-medium text-muted mb-2">设置密码</label>
                            <div class="relative">
                                <span class="absolute inset-y-0 left-0 flex items-center pl-3 text-muted">
                                    <i class="fa fa-lock"></i>
                                </span>
                                <input type="password" id="regPassword" class="w-full pl-10 pr-10 py-3 border border-gray-300 rounded-lg input-focus transition-all duration-300" placeholder="8-20位字母+数字组合" required>
                                <button type="button" id="toggleRegPwd" class="absolute inset-y-0 right-0 flex items-center pr-3 text-muted hover:text-accent transition-colors duration-300">
                                    <i class="fa fa-eye-slash"></i>
                                </button>
                            </div>
                        </div>
                        
                        <!-- 确认密码 -->
                        <div class="mb-8">
                            <label for="confirmPwd" class="block text-sm font-medium text-muted mb-2">确认密码</label>
                            <div class="relative">
                                <span class="absolute inset-y-0 left-0 flex items-center pl-3 text-muted">
                                    <i class="fa fa-check-circle"></i>
                                </span>
                                <input type="password" id="confirmPwd" class="w-full pl-10 pr-10 py-3 border border-gray-300 rounded-lg input-focus transition-all duration-300" placeholder="请再次输入密码" required>
                                <button type="button" id="toggleConfirmPwd" class="absolute inset-y-0 right-0 flex items-center pr-3 text-muted hover:text-accent transition-colors duration-300">
                                    <i class="fa fa-eye-slash"></i>
                                </button>
                            </div>
                        </div>
                        
                        <!-- 注册按钮 -->
                        <button type="submit" class="w-full bg-accent hover:bg-accent-dark text-white font-semibold py-3 px-4 rounded-lg transition-all duration-300 transform hover:-translate-y-0.5 hover:shadow-md">
                            立即注册
                        </button>
                    </form>
                    
                    <!-- 登录引导 -->
                    <div class="mt-8 text-center">
                        <span class="text-sm text-muted">已有账号？</span>
                        <a href="login.html" class="text-sm font-medium text-accent hover:text-accent-dark transition-colors duration-300 ml-1">立即登录</a>
                    </div>
                </div>
            </div>
        </div>
    </main>

    <!-- 页脚（与首页一致） -->
    <footer class="footer bg-gray-900 text-white py-12 md:py-16">
        <div class="container mx-auto px-4">
            <div class="footer-container grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-8 md:gap-12">
                <div class="footer-column">
                    <h3 class="text-lg font-semibold mb-4">产品</h3>
                    <ul class="footer-links space-y-2">
                        <li><a href="index.html" class="text-gray-400 hover:text-white transition-colors duration-300">HUAPLE 标准版</a></li>
                        <li><a href="index.html#air" class="text-gray-400 hover:text-white transition-colors duration-300">HUAPLE Air</a></li>
                        <li><a href="index.html#pro" class="text-gray-400 hover:text-white transition-colors duration-300">HUAPLE Pro</a></li>
                        <li><a href="index.html#pro-max" class="text-gray-400 hover:text-white transition-colors duration-300">HUAPLE Pro Max</a></li>
                        <li><a href="index.html#ultra" class="text-gray-400 hover:text-white transition-colors duration-300">HUAPLE Ultra</a></li>
                    </ul>
                </div>
                
                <div class="footer-column">
                    <h3 class="text-lg font-semibold mb-4">服务与支持</h3>
                    <ul class="footer-links space-y-2">
                        <li><a href="service.html" class="text-gray-400 hover:text-white transition-colors duration-300">HUAPLE 支持</a></li>
                        <li><a href="service.html#repair" class="text-gray-400 hover:text-white transition-colors duration-300">维修服务</a></li>
                        <li><a href="service.html#skills" class="text-gray-400 hover:text-white transition-colors duration-300">使用技巧</a></li>
                        <li><a href="service.html#faq" class="text-gray-400 hover:text-white transition-colors duration-300">常见问题</a></li>
                    </ul>
                </div>
                
                <div class="footer-column">
                    <h3 class="text-lg font-semibold mb-4">关于华凤</h3>
                    <ul class="footer-links space-y-2">
                        <li><a href="about.html" class="text-gray-400 hover:text-white transition-colors duration-300">公司简介</a></li>
                        <li><a href="about.html#news" class="text-gray-400 hover:text-white transition-colors duration-300">新闻中心</a></li>
                        <li><a href="about.html#join" class="text-gray-400 hover:text-white transition-colors duration-300">招贤纳士</a></li>
                    </ul>
                </div>
                
                <div class="footer-column">
                    <h3 class="text-lg font-semibold mb-4">购物相关</h3>
                    <ul class="footer-links space-y-2">
                        <li><a href="index.html#buy" class="text-gray-400 hover:text-white transition-colors duration-300">立即购买</a></li>
                        <li><a href="#" class="text-gray-400 hover:text-white transition-colors duration-300">订单查询</a></li>
                        <li><a href="#" class="text-gray-400 hover:text-white transition-colors duration-300">配送信息</a></li>
                    </ul>
                </div>
            </div>
            
            <div class="border-t border-gray-800 my-8 pt-8">
                <div class="flex flex-col md:flex-row justify-between items-center">
                    <div class="mb-4 md:mb-0">
                        <a href="index.html" class="flex items-center font-bold text-xl text-white no-underline">
                            <span class="text-accent">HUA</span>PLE
                        </a>
                    </div>
                    <div class="flex space-x-4">
                        <a href="#" class="w-10 h-10 rounded-full bg-gray-800 hover:bg-accent flex items-center justify-center transition-all duration-300">
                            <i class="fa fa-weibo text-white"></i>
                        </a>
                        <a href="#" class="w-10 h-10 rounded-full bg-gray-800 hover:bg-accent flex items-center justify-center transition-all duration-300">
                            <i class="fa fa-wechat text-white"></i>
                        </a>
                        <a href="#" class="w-10 h-10 rounded-full bg-gray-800 hover:bg-accent flex items-center justify-center transition-all duration-300">
                            <i class="fa fa-instagram text-white"></i>
                        </a>
                    </div>
                </div>
            </div>
            
            <div class="footer-bottom text-center text-gray-500 text-sm">
                <p>© 2025 华凤技术有限公司 保留所有权利。</p>
                <div class="mt-3">
                    <a href="#" class="hover:text-gray-300 transition-colors duration-300">隐私政策</a> · 
                    <a href="#" class="hover:text-gray-300 transition-colors duration-300">服务条款</a> · 
                    <a href="#" class="hover:text-gray-300 transition-colors duration-300">法律信息</a>
                </div>
            </div>
        </div>
    </footer>

    <!-- 回到顶部按钮 -->
    <button id="backToTop" class="fixed bottom-6 right-6 bg-accent hover:bg-accent-dark text-white w-12 h-12 rounded-full flex items-center justify-center shadow-lg transition-all duration-300 transform scale-0 hover:scale-105 focus:outline-none z-50">
        <i class="fa fa-arrow-up"></i>
    </button>

    <script>
        // 回到顶部功能
        const backToTopBtn = document.getElementById('backToTop');
        window.addEventListener('scroll', () => {
            if (window.scrollY > 300) {
                backToTopBtn.classList.replace('scale-0', 'scale-100');
            } else {
                backToTopBtn.classList.replace('scale-100', 'scale-0');
            }
        });
        backToTopBtn.addEventListener('click', () => {
            window.scrollTo({ top: 0, behavior: 'smooth' });
        });

        // 密码显示/隐藏切换（设置密码）
        const toggleRegPwdBtn = document.getElementById('toggleRegPwd');
        const regPasswordInput = document.getElementById('regPassword');
        toggleRegPwdBtn.addEventListener('click', () => {
            const type = regPasswordInput.getAttribute('type') === 'password' ? 'text' : 'password';
            regPasswordInput.setAttribute('type', type);
            toggleRegPwdBtn.innerHTML = type === 'password' ? '<i class="fa fa-eye-slash"></i>' : '<i class="fa fa-eye"></i>';
        });

        // 密码显示/隐藏切换（确认密码）
        const toggleConfirmPwdBtn = document.getElementById('toggleConfirmPwd');
        const confirmPwdInput = document.getElementById('confirmPwd');
        toggleConfirmPwdBtn.addEventListener('click', () => {
            const type = confirmPwdInput.getAttribute('type') === 'password' ? 'text' : 'password';
            confirmPwdInput.setAttribute('type', type);
            toggleConfirmPwdBtn.innerHTML = type === 'password' ? '<i class="fa fa-eye-slash"></i>' : '<i class="fa fa-eye"></i>';
        });

        // 获取验证码倒计时
        const getCodeBtn = document.getElementById('getCodeBtn');
        const phoneInput = document.getElementById('phone');
        let countdown = 0;
        
        getCodeBtn.addEventListener('click', () => {
            const phone = phoneInput.value.trim();
            if (!/^1[3-9]\d{9}$/.test(phone)) {
                alert('请输入有效的手机号');
                return;
            }
            
            if (countdown > 0) return;
            
            // 模拟发送验证码
            alert('验证码已发送至您的手机，请注意查收');
            
            // 倒计时逻辑
            countdown = 60;
            getCodeBtn.disabled = true;
            getCodeBtn.textContent = `${countdown}s后重新获取`;
            
            const timer = setInterval(() => {
                countdown--;
                getCodeBtn.textContent = `${countdown}s后重新获取`;
                
                if (countdown <= 0) {
                    clearInterval(timer);
                    getCodeBtn.disabled = false;
                    getCodeBtn.textContent = '获取验证码';
                }
            }, 1000);
        });

        // 注册表单提交处理
        const registerForm = document.getElementById('registerForm');
        registerForm.addEventListener('submit', (e) => {
            e.preventDefault();
            
            const phone = phoneInput.value.trim();
            const code = document.getElementById('code').value.trim();
            const regPassword = regPasswordInput.value.trim();
            const confirmPwd = confirmPwdInput.value.trim();
            
            // 表单验证
            if (!/^1[3-9]\d{9}$/.test(phone)) {
                alert('请输入有效的手机号');
                return;
            }
            
            if (code.length !== 6) {
                alert('请输入6位验证码');
                return;
            }
            
            if (regPassword.length < 8 || regPassword.length > 20 || !/^(?=.*[a-zA-Z])(?=.*\d).+$/.test(regPassword)) {
                alert('密码需为8-20位字母+数字组合');
                return;
            }
            
            if (regPassword !== confirmPwd) {
                alert('两次输入的密码不一致');
                return;
            }
            
            // 模拟注册成功
            alert('注册成功！即将跳转到登录页面');
            window.location.href = 'login.html';
        });
    </script>
</body>
</html>